package com.csj.DesignPattern.spring.customSpring.framework;

import java.util.HashMap;
import java.util.Map;

public class SimpleBeanDefinitionRegistry implements BeanDefinitionRegistry {

    private Map<String, BeanDefinition> map = new HashMap<>();

    @Override
    public void registerBeanDefinition(String var1, BeanDefinition var2) throws Exception {
        map.put(var1, var2);
    }

    @Override
    public void removeBeanDefinition(String var1) throws Exception {
        map.remove(var1);
    }

    @Override
    public BeanDefinition getBeanDefinition(String var1) throws Exception {
        return map.get(var1);
    }

    @Override
    public boolean containsBeanDefinition(String var1) throws Exception {
        return getBeanDefinition(var1) != null;
    }

    @Override
    public String[] getBeanDefinitionNames() {
        return map.keySet().toArray(new String[0]);
    }

    @Override
    public int getBeanDefinitionCount() {
        return map.size();
    }
}
